const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            category: [],
             tagOptions: []  // 存储标签选项
        };
    },
    mounted() {
        this.getCategory();
         this.loadTagOptions(); 
    },
    // watch:{
    //     'dataForm.News_Content'(val){
    //         console.log(val);
    //     }
    // },
methods: {
    loadTagOptions() {
        // 使用内联JSON数据
        const tagData = [
            { "Poor_households": "贫困户" },
            { "low-income_households": "低保户" },
            { "five-guarantee_households": "五保户" },
            { "low-income_households": "兜底户" },
            { "disabled_households": "残疾户" }
        ];
        
        // 修改：直接使用值作为value
        this.tagOptions = tagData.map(item => {
            const key = Object.keys(item)[0];
            return {
                value: item[key],   // 存储值（如"贫困户"）
                label: item[key]    // 显示值（如"贫困户"）
            };
        });
    },
        getCategory() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'news_category',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.category = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        }
    },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus,{locale: zhCn});
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-upload', ylUpload);
app.component('yl-text-editor', ylTextEditor);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
